#ifndef _RETURNVAL_H__
#define _RETURNVAL_H__

#include <cstdlib>

enum RETURN_VAL {
  _NORMAL,
  _PosNotFind_insertInstr_BasicBlock,
  _False_assertValid_BinaryInst,
  _False_assertValid_CmpInst,
  _ArgsNotMatch_Constructor_CallInst,
  _NotCondBr_fuseCmpInst_BranchInst,
  _cmpUsedMoreThanOnce_fuseCmpInst_BranchInst,
  _ElementIsArrayOrInterger_getElementType_GetElementPtrInst,
  _IndexError_getElementType_GetElementPtrInst,
  _LoadFromErrorType_Constructor_LodInst,
  _ElemIsNotTargetType_Constructor_LodInst,
  _Constructor_VVInst,
  _InvalidRetVal_Constructor_FunctionType,
  _InvalidArgType_Constructor_FunctionType,
  _InvalidElemType_Constructor_ArrayType,
  _OutOfIndex_setOperand_User,
  _EmptyUse_replaceAllUseWith_Value,
  _CantFindUse_removeUse_Value,
  _CantGetDefVal_getDefVal_BBConstPropagation,
  _CantSetDefVal_setDefVal_BBConstPropagation,
  _CantFindSuitableOp_compute_ConstFlod,
  _DeadInsButNotDelete_deleteDeadInst_DeadCodeEliminate,
  _deleteDeadStore_DeadCodeEliminate,
  _assertPredFalse_createIDom_Dominators,
  _getIDomFalse_intersect_Dominators,
  _CantGetMain_run_FunctionInline,
  _funcUsedByNonCall_createFuncSucc_FunctionInline,
  _NotCallInst_inlining_FunctionInline,
  _copyhasWrong_copyBasicBlocks_FunctionInline,
  _NewBBEmpty_copyBasicBlocks_FunctionInline,
  _NewInsEmpty_copyBasicBlocks_FunctionInline,
  _ConvBBfalse_splitBasicBlock_FunctionInline,
  _CantGetTerminotor_handleReturns_FunctionInline,
  _RetHasMoreThanOneOp_handleReturns_FunctionInline,
  _caeateStoreErr_handleReturns_FunctionInline,
  _createBrErr_handleReturns_FunctionInline,
  _deleteBr_handleReturns_FunctionInline,
  _handleVoidReturn_FunctionInline,
  _handlePHIReturns_FunctionInline,
  _ConvInsErr_run_GlobalVarivaleLocal,
  _whileExit_genBaseBlock_HIRTOMIR,
  _whileEntry_genBaseBlock_HIRTOMIR,
  _condSizeMoreThanOne_genBaseBlock_HIRTOMIR,
  _CondBegin_genBaseBlock_HIRTOMIR,
  _notSecheduleInst_schedule_InstructionSchedule,
  _ReadyEmpty_schedule_InstructionSchedule,
  _Eq_schedule_InstructionSchedule,
  _assertEqual_InstructionSchedule,
  _NodesEmpty_run_LoopFind,
  _hadBeen_findLoopBase_LoopFind,
  _baseEmpty_findLoopBase_LoopFind,
  _getParentLoop_LoopFind,
  _fuseCmpBr_LowerIR,
  _convertMulDivToShift_LowerIR,
  _convertRemToAnd_LowerIR,
  _fuseAddLoadStore_LowerIR,
  _removeUnusedOp_LowerIR,
  _refactor_RefactorPartIns,
  _MergeSinglePredecessorBB_SimplifyCFG,
  _EliminateSingleUnCondBrBB_SimplifyCFG,
  _GenPhi_Mem2RegPass,
  _createAdd_BinaryInst,
  _getFunction_Function,
  _getArgNo_Argument,
  _splitGEP_LowerIR,
  _UnoknowBaseBB_genBaseBlock_HIRTOMIR,
  _EliminateSinglePredecessorPhi_SimplifyCFG,
  _getFromSpecificReg_CodeGen,
  _generateFunctionEntryCode_CodeGen,
  _op2Const_generateInstructionCode_CodeGen,
  _shift_generateInstructionCode_CodeGen,
  _op3Const_generateInstructionCode_CodeGen,
  _shift3_generateInstructionCode_CodeGen,

  _ABORT_MANAL = 255,
};

static void exit_ifnot(RETURN_VAL ret, bool cond) {
  if (cond == false)
    exit(ret);
}

#endif